Hadamard gate
Contents
5.5. Hadamard gate#
This is another very important one-qubit gate. It changes basis set between \(\{|0\rangle,|1\rangle\}\) and \(\{|+\rangle,|-\rangle\}\). We shall call this gate simply HGate.
Definition#
(5.5)#\[ H |0\rangle = |+\rangle, \qquad H |1\rangle = |-\rangle \]
This is the standard way tio generate \(|\pm\rangle\) from the computational basis.
The standard symbol is \(H\) and it appears in quantum circuit as
from qiskit import QuantumCircuit
qc=QuantumCircuit(1)
qc.h(0)
qc.draw()
┌───┐ q: ┤ H ├ └───┘
Qiskit Example 5.5.1 A common use of the Hadamard gate is to switch the basis set basis set. In the quantum simulation of coin tossing (Qiskit Example 4.2.1) we have already used a Hadamard gate to generate \(+\rangle\). Here we flip \(|0\rangle\) to \(|1\rangle\) in \(|\pm\rangle\) basis. First, we switch the basis from \(|0\rangle\) to \(|+\rangle\) by HGate. Flip \(|+\rangle\) to \(|-\rangle\) by ZGate. Then, switch back to the original basis by HGate. The final state is \(|1\rangle\).
This means \(X = H Z H\). In this example, the following process is visualized with Qiskit.
%%capture
from qiskit import *
from qiskit.visualization import visualize_transition
qc=QuantumCircuit(1)
qc.h(0)
qc.z(0)
qc.h(0)
movie=visualize_transition(qc,fpg=50, spg=1)
movie